#@tabLayout()

#define main()
<div style="">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 学生管理 <span class="c-gray en">&gt;</span> 学生列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">
		<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><!--<a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>--> <a class="btn btn-primary radius" onclick="student_add('添加学生','#(baseUrl)/student/addPage')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加学生</a></span></div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-bg table-hover table-sort" id="student-table">
				<thead>
					<tr class="text-c">
						<th>学号</th>
						<th>姓名</th>
						<th>性别</th>
						<th>专业</th>
						<th>班级</th>
						<th>年龄</th>
						<th>电话</th>
						<th>籍贯</th>
						<th>操作</th>
					</tr>
				</thead>
			</table>
		</div>
	</div>
</div>
#end

#define js()
<script type="text/javascript">

var student_table = $('#student-table').DataTable({
	"processing": true,
	"serverSide": true,
	"ajax":"#(baseUrl)/student/list",
	"columns": [
		{"data":"Student_ID",},
		{"data":"Student_name"},
		{"data":"Sex"},
		{"data":"Major"},
		{"data":"Class"},
		{"data":"Age"},
		{"data":"Phone"},
		{"data":"City"},
		{
			"data":null,
			"render":function(data, type, full ,meta){
				return '<a style="text-decoration:none" class="ml-5" onClick="student_del(this,\''+full.Student_ID+'\')" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>'+
						'<a style="text-decoration:none" class="ml-5" onClick="student_edit(this,\''+full.Student_ID+'\')" href="javascript:;" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a>'
			}
		}
	]
});
/*学生-添加*/
function student_add(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url,
		end:function(){
			student_table.ajax.reload();
		}
	});
	layer.full(index);
}

/*学生-编辑*/
function student_edit(title,id){
	var index = layer.open({
		type: 2,
		title: "编辑学生",
		content: "#(baseUrl)/student/addPage?id="+id,
		end:function(){
			student_table.ajax.reload();
		}
	});
	layer.full(index);
}

/*学生-删除*/
function student_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax({
			type: 'POST',
			url: '#(baseUrl)/student/remove',
			data: {"id":id},
			dataType: 'json',
			success: function(data){
				student_table.ajax.reload();
				layer.msg('已删除!',{icon:1,time:1000});
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}
</script>
#end